/**
 * 计划管理 api
 * @author xiaoxujs
 */

import { basicIp, newHttpService } from "../../../api/http"
import { IPlanApproveParams, IPlanCancelParams, IPlanCarInsertPlanDetailsParams, IPlanCarQueryPlanCarParams, IPlanCarShipDetailParams, IPlanInsertPlanParams, IPlanLoadDetailParams, IPlanPlanApprovalPageParams, IPlanPlanPageParams, IPlanSupplementPlanParams } from "../../../type/planManagement";

//  发运计划 - 列表
export const postPlanPlanPage = (data: IPlanPlanPageParams) => {
    const url = basicIp + '/plan/planPage';
    return newHttpService.postData(url, data)
}
// 查询货品名称列表
export const getPlanGoodsNames = () => {
    const url = basicIp + '/plan/goodsNames';
    return newHttpService.getData(url);
}
// 查询物流单位
export const getPlanTransportNames = () => {
    const url = basicIp + '/plan/transportNames';
    return newHttpService.getData(url)
}
// 添加计划
export const putPlanInsertPlan = (data: IPlanInsertPlanParams) => {
    const url = basicIp + '/plan/insertPlan';
    return newHttpService.putData(url, data)
}
//  补充计划量
export const postPlanSupplementPlan = (data: IPlanSupplementPlanParams) => {
    const url = basicIp + '/plan/supplementPlan';
    return newHttpService.postData(url, data)
}
// 作废发运计划
export const postPlanCancel = (data: IPlanCancelParams) => {
    const url = basicIp + '/plan/cancel';
    return newHttpService.postData(url, data)
}
// 删除发运计划
export const getPlanDelete = (data: { id: string }) => {
    const url = basicIp + '/plan/delete';
    return newHttpService.getData(url, data)
}
// 计划审核列表
export const postPlanPlanApprovalPage = (data: IPlanPlanApprovalPageParams) => {
    const url = basicIp + '/plan/planApprovalPage';
    return newHttpService.postData(url, data)
}
// 计划审核 - 审批
export const postPlanApprove = (data: IPlanApproveParams) => {
    const url = basicIp + '/plan/approve';
    return newHttpService.postData(url, data)
}
//  车辆管理 - 列表
export const postPlanCarQueryPlanCar = (data: IPlanCarQueryPlanCarParams) => {
    const url = basicIp + '/planCar/queryPlanCar';
    return newHttpService.postData(url, data)
}
//  车辆管理 - 移除车辆 - 解绑车辆
export const postPlanCarUnbind = (data: string[]) => {
    const url = basicIp + '/planCar/unbind';
    return newHttpService.postData(url, data)
}
//  车辆管理 - 提交车辆
export const putPlanCarInsertPlanDetails = (data: IPlanCarInsertPlanDetailsParams) => {
    const url = basicIp + '/planCar/insertPlanDetails';
    return newHttpService.putData(url, data)
}
// 车辆管理 - 新增车辆 - 模板下载url
export const urlPlanCarDownloadTemplateGet = basicIp + '/planCar/downloadTemplate';
// // 车辆管理 - 解绑车辆
// export const postPlanCarUnbind = (data: {ids: string[]}) => {
//     const url = basicIp + '/planCar/unbind';
//     return newHttpService.postData(url, data)
// }
// 车辆管理 - 发运量统计
export const getPlanShipTotal = (data: {id: string}) => {
    const url = basicIp + '/plan/shipTotal';
    return newHttpService.getData(url, data)
}
// 车辆发运明细
export const postPlanCarShipDetail = (data: IPlanCarShipDetailParams) => {
    const url = basicIp +  '/plan/carShipDetail';
    return newHttpService.postData(url, data)
}
//  车辆发运分析 - 列表
export const getPlanCarShipAnalysis = (data: {planNo: string}) => {
    const url = basicIp + '/plan/carShipAnalysis';
    return newHttpService.getData(url, data);
}
// 装车明细 - 列表
export const postPlanLoadDetail = (data: IPlanLoadDetailParams) => {
    const url = basicIp + '/plan/loadDetail';
    return newHttpService.postData(url, data);
}
//plan/generateCode
export const getPlanGenerateCode = (data: {planId: string}) => {
    const url = basicIp + '/plan/generateCode';
    return newHttpService.getData(url, data);
}